SWEP.Author="Alex Powell"
SWEP.Contact=""
SWEP.Purpose=""
SWEP.Instructions=""

-- SEWP Config --
SWEP.Primary.Clipsize=-1
SWEP.Primary.DefaultClip=-1
SWEP.Primary.Automatic=false
SWEP.Primary.Ammo="none"
SWEP.Secondary.Clipsize=-1
SWEP.Secondary.DefaultClip=-1
SWEP.Secondary.Automatic=false
SWEP.Secondary.Ammo="none"

-- Sound --
local ShootSound=Sound("buttons/combine_button"..math.random(1,3)..".wav")

-- Hide models --
function SWEP:Deploy()
	if SERVER then
		self.Owner:DrawViewModel(false)
		self.Owner:DrawWorldModel(false)
	end
end

-- Left click function --
function SWEP:PrimaryAttack()
	local tr=self.Owner:GetEyeTraceNoCursor()
	if tr.Entity then
		if(tr.Entity:IsDoor()and(self.Owner:GetPos():Distance(tr.Entity:GetPos()))<300)then
			if SERVER then
				tr.Entity:Fire("Toggle","true",0.2)
			end
			self.Owner:EmitSound(ShootSound)
		end
	end
end